export default function getUrlParam(name?: string) {
    let url = window.location.href;
    let param = url.split("?")[1];
    let paramObj = {} as Record<string, any>;
    if (param) {
        let paramArr = param.split("&");
        paramArr.forEach(item => {
            let itemArr = item.split("=");
            paramObj[itemArr[0]] = itemArr[1];
        });
        return name ? paramObj[name] : paramObj;
    }
    return null;
}